﻿#region
using System;
using System.ComponentModel;
using System.Windows.Forms;
using AfricaDownloader.Properties;

#endregion

namespace AfricaDownloader
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (DesignMode)
                return;

            Icon = Resources.tv1;
            Text += " - " + Utility.GetVersionText();
        }

        protected override void OnClosing(CancelEventArgs e)
        {
            Settings.Default.Save();

            base.OnClosing(e);
        }

        private void uscCommand_Started(object sender, CommandControl.StartedEventArgs e)
        {
            var urls = Utility.ExtractDownloadableUrls(e.AfricaUrl);
            uscDownloadViewer.AddControls(urls);
        }

        private void uscDownloadViewer_AllDownloadsCompleted(object sender, DownloadViewer.AllDownloadsCompletedEventArgs e)
        {
            uscCommand.Enabled = true;
        }
    }
}